//
//  MyNotificationViewController.m
//  SmartCoin
//
//  Created by apple on 2018/3/15.
//  Copyright © 2018年 Cynic. All rights reserved.
//

#import "MyNotificationViewController.h"
#import "MyNotificationTableViewCell.h"
static NSString *MyNotificationTableviewCellIndentifier = @"MyNotificationTableviewCellIndentifier";
@interface MyNotificationViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic ,retain)UITableView *mainView;
@end

@implementation MyNotificationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = bggrayColor;
    [self viewLoad];
}

-(void)viewLoad{
    [self navigationViewLoad];
    [self mainViewLoad];
}

-(void)navigationViewLoad{
    UIView *navigationview = [[UIView alloc] initWithFrame:CGRectMake(0, cxsingler.topdis, cx_wid, 44 )];
    CAGradientLayer *layer = [CAGradientLayer layer];
    layer.frame = navigationview.bounds;
    layer.colors = @[(id)[CXSinglerModel colorWithHex:@"#FF7F5A" alpha:1].CGColor,(id)[CXSinglerModel colorWithHex:@"#FE4438" alpha:1].CGColor];
    layer.startPoint = CGPointMake(0, 0);
    layer.endPoint = CGPointMake(1, 0);
    [navigationview.layer addSublayer:layer];
    [self.view addSubview:navigationview];
    
    [self setNavigationViewWithTitle:@"我的通知" WithCanPop:YES WithPopData:@"return" WithPopisString:NO WithHasRightOperation:YES WithrightOperationData:@"more_white" WithRightisString:NO WithNavigationColor:[UIColor clearColor] withBgView:self.view];
}

-(void)mainViewLoad{
    if (!_mainView) {
        _mainView = [[UITableView alloc] initWithFrame:CGRectMake(0, cxsingler.topdis + 44 , cx_wid, cx_hit - cxsingler.topdis - 44)];
        _mainView.delegate = self;
        _mainView.dataSource = self;
        _mainView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _mainView.backgroundColor = [UIColor clearColor];
        [_mainView registerClass:[MyNotificationTableViewCell class] forCellReuseIdentifier:MyNotificationTableviewCellIndentifier];
        [self.view addSubview:_mainView];
    }
}

#pragma mark--uitableview代理开始
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 6;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 70;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MyNotificationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyNotificationTableviewCellIndentifier];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.namelabel.text = @"犀牛犀牛";
    cell.wordlabel.text = @"我的新店开张啦";
    cell.timelabel.text = @"12/30 15:04";
    return cell;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger row = indexPath.row;
    NSLog(@"taped:??");
}

-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
    return @"删除";
}

#pragma mark--uitabelview代理结束

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
